package de.tum.team26.eistpoll.client;

import java.util.LinkedList;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import de.tum.team26.eistpoll.shared.PollData;

/**
 * RPC Interface Class required by GWT
 */
@RemoteServiceRelativePath("pollService")
public interface PollService extends RemoteService{
	
	/**
	 * Method to push poll data to the server
	 * @param id PollID
	 * @param option PollOption
	 * @param like Like String
	 * @param dislike Dislike String
	 */
	void pushPollData(int id, int option, String like, String dislike);
	
	/**
	 * Poll results from the Server
	 * @param isLecturer If user is Lecturer or not
	 * @return LinkedList of Polls
	 */
	LinkedList<PollData> getResults(boolean isLecturer);
	
	/**
	 * Check if Username and Password match
	 * @param user Username
	 * @param pass Password
	 * @return Boolean Value if User is valid
	 */
	boolean checkUser(String user, String pass);
	
	/**
	 * Establish Connection for the Push Service
	 * @return true if there are changes, false if not
	 */
	boolean pushService();
	
	/**
	 * Reset the Statistic of a Poll
	 * @param id Id of Poll to reset
	 */
	void resetStatistic(int id);
	
	/**
	 * Delete Poll
	 * @param id Id of Poll to delete
	 */
	void deletePoll(int id);
	
	/**
	 * Switch Poll State
	 * @param id ID of Poll to switch
	 */
	void switchPollActive(int id);
	
	/**
	 * Add Poll
	 * @param title Title of Poll to add
	 */
	void addPoll(String title);
	
	/**
	 * Return Poll Data of Active Poll
	 * @return null if no Poll is active
	 */
	PollData getActivePoll();

}
